<!--
*@Author: QWP
*@Description: 地图高亮的数据显示
*@Date: 2024-10-31 14:14:04
-->
<template>
  <!-- 汇总数据 -->
  <div class="u-map-hover-detial"
    :style="{'display': show ? 'block' : 'none'}">
    <u-loading-box :spinning="loading">
      <div class="u-map-hovr-detial-title">
        {{  data.label  }}
      </div>
      <div style="display: flex; justify-content: space-between" 
        class="u-tip-all-content-box">
        <div v-for="item in data.data"
          class="u-map-hover-detial-box">
          <div class='u-map-tip-img'
            :style="{'background': item.bgColor }">
            <img :src="item.img" width="30px" height="30px"/> 
          </div>
          <div class='u-map-tip-item-title'>{{ item.title }}
          </div>
          <div style="margin-top: 8px">
            <span class='u-map-tip-item-value'>{{ item.value }}
            </span>
            <span class='u-map-tip-item-unit'>{{  item.unit  }}</span>
          </div>
        </div>
      </div>
    </u-loading-box>
  </div>
</template>

<script lang='ts' setup>
import { ref, reactive, computed, onMounted } from 'vue' 
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'

defineProps<{
  show: boolean,
  loading: boolean,
  data: any | object
}>()
</script>

<style lang='scss' scoped>
.u-map-hover-detial {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  width: 400px;
  background: linear-gradient( 169deg, rgba(199,228,255,0.8) 0%, rgba(249,252,255,0.8) 100%);
  border-radius: 16px 16px 16px 16px;
  border: 2px solid #FFFFFF;
  z-index: 100;
  .u-map-hovr-detial-title {
    font-family: PingFang SC Medium, PingFang SC Medium;
    font-weight: 400;
    font-size: 16px;
    color: #333333;
    line-height: 22px;
    text-align: left;
    font-style: normal;
    text-transform: none;
  }
  .u-tip-all-content-box {
    .u-map-hover-detial-box {
      position: relative;
      display: flex; 
      flex-direction: column; 
      padding-top: 20px;
      &::after {
        content: '';
        position: absolute;
        width: 1px;
        height: 80%;
        right: -50%;
        top: 50%;
        transform: translateY(-50%);
        background-color: #B7DCFF;
      }
      &:last-child {
        &::after { 
          width: 0;
        }
      }
    }
    .u-map-tip-img{
      display: flex; 
      justify-content: center; 
      align-items: center; 
      width: 48px; 
      height: 48px;
      border-radius: 16px 16px 16px 16px;
    }
    .u-map-tip-item-title {
      margin-top: 16px; 
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 14px;
      color: #666666;
    }
    .u-map-tip-item-value {
      font-family: DIN, DIN;
      font-weight: 500;
      font-size: 18px;
      color: #333333;
    }
    .u-map-tip-item-unit {
      font-family: DIN, DIN;
      font-weight: 400;
      font-size: 12px;
      font-weight: 500;
      font-size: 18px;
      color: #666666;
    }
  }
}
</style>